<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        [v-cloak]{
            display:none;
        }
    </style>
    <script type='text/javascript' src='../js/vue.js'></script>
    <script type='text/javascript' src=''></script>

</head>

<body>
    <!-- 
        
     -->
    <div id="root">
        <div>当前n值是：<span v-text="n"></span></div>
        <div>放大10倍后的n值：<span v-big="n"></span></div><br/>
        <button @click="n++">点击n+1</button>
    </div>
    <script>
        Vue.config.productionTip = false;

        new Vue({
            el: '#root',
            data: {
                n:1
            },
            directives:{
                //big函数调用：1、指令与函数成功绑定 2、指令所在模板被重新解析时
                big(element,binding){
                    // console.log(element instanceof HTMLElement)
                    console.log(element,binding)
                    element.innerText = binding.value * 10
                }
            }

        })
    </script>
</body>

</html>